package org.sport.model.entityModel;

import javax.persistence.*;

/**
 * Created by Allen on 2017/9/29.
 */
@Entity
@Table(name = "linkapplyhistory", schema = "sportinfo", catalog = "")
public class LinkapplyhistoryEntity {
    private int id;
    private String status;
    private UsertableEntity usertableByApplyUserId;
    private UsertableEntity usertableByBeApplyUserId;
    private GrouptableEntity grouptableByBeApplyGroupId;

    @Id
    @Column(name = "_id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "status", nullable = true, length = 45)
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        LinkapplyhistoryEntity that = (LinkapplyhistoryEntity) o;

        if (id != that.id) return false;
        if (status != null ? !status.equals(that.status) : that.status != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (status != null ? status.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "applyUserId", referencedColumnName = "_id")
    public UsertableEntity getUsertableByApplyUserId() {
        return usertableByApplyUserId;
    }

    public void setUsertableByApplyUserId(UsertableEntity usertableByApplyUserId) {
        this.usertableByApplyUserId = usertableByApplyUserId;
    }

    @ManyToOne
    @JoinColumn(name = "beApplyUserId", referencedColumnName = "_id")
    public UsertableEntity getUsertableByBeApplyUserId() {
        return usertableByBeApplyUserId;
    }

    public void setUsertableByBeApplyUserId(UsertableEntity usertableByBeApplyUserId) {
        this.usertableByBeApplyUserId = usertableByBeApplyUserId;
    }

    @ManyToOne
    @JoinColumn(name = "beApplyGroupId", referencedColumnName = "_id")
    public GrouptableEntity getGrouptableByBeApplyGroupId() {
        return grouptableByBeApplyGroupId;
    }

    public void setGrouptableByBeApplyGroupId(GrouptableEntity grouptableByBeApplyGroupId) {
        this.grouptableByBeApplyGroupId = grouptableByBeApplyGroupId;
    }
}
